package com.shanzmoo.db.personnel.entity.vo;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.personnel.entity.MemberInfoEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDate;

/**
 * 会员详情信息
 * @author: Gzhao 2020/12/20
 */
@Data
@ApiModel("会员详情信息")
public class MallMemberInfoVo {

    @ApiModelProperty("客户id")
    private Integer memberId;

    @ApiModelProperty("微信头像")
    private String avatarUrl;

    @ApiModelProperty("微信昵称")
    private String nickname;

    @ApiModelProperty("用户等级")
    private String level = "一般用户";

    @ApiModelProperty("会员属性:0-普通会员，1-企业会员")
    private Integer type;

    @ApiModelProperty("生日")
    private LocalDate birthday;

    @ApiModelProperty("邮箱")
    private String email;

    @ApiModelProperty("手机号")
    private String mobile;

    @ApiModelProperty("默认地址")
    private MemberAddressVo defaultAddress;

    @ApiModelProperty("默认发票")
    private MemberInvoiceVo defaultInvoice;

    public static MallMemberInfoVo create(MemberInfoEntity member) {
        MallMemberInfoVo memberInfoVo = JSON.parseObject(JSON.toJSONString(member), MallMemberInfoVo.class);
        memberInfoVo.setMemberId(member.getId());

        return memberInfoVo;
    }
}
